package com.cxyzy.aopdemo;

import android.app.Activity;
import android.content.Intent;

import static com.cxyzy.aopdemo.Constant.AFTER_LOGIN_INTENT;

public class LoginIntercept {
    public static void startActivity(Activity activity, Intent intent, Class loginActivityClass) {
        if (Constant.isLogged) {
            activity.startActivity(intent);
        } else {
            Intent newIntent = new Intent(activity, loginActivityClass);
            newIntent.putExtra(AFTER_LOGIN_INTENT, intent);
            activity.startActivity(newIntent);
        }
    }
}
